<template>
  <div class="works-box">
    <header class="box-header">
      <p class="box-header-title">作品</p>
      <p class="box-header-author"> BY 家里一只狗</p>
    </header>

    <div class="box-content">
      <template v-for="(item, index) in cardDate">
        <div @click="jumpToDetail">
          <el-card
            :body-style="cardBodyStyle"
            shadow="hover"
            class="card-container"
          >
            <el-row class="card-item">
              <el-col :span="24" class="card-image">
                <img :src="item.img">
              </el-col>
            </el-row>
            <div style="padding: 14px;" class="card-introduce">
              <span>{{ item.title }}</span>
              <div class="bottom clearfix">
                <time class="time">{{ item.content }}</time>
              </div>
              <div class="en-text">
                GitHub is a development platform inspired by the way you work. From open source to business, you can host and review code, manage projects, and build software alongside 31 million developers.
              </div>
            </div>
          </el-card>
        </div>
      </template>
    </div>
  </div>
</template>

<script>

export default {
  data() {
    return {
      cardBodyStyle: {
        padding: 0,
        height: '300px'
      },
      cardDate: [
        {
          img: require('@/assets/material01.jpg'),
          title: '作品123213',
          content: new Date()
        },
        {
          img: require('@/assets/material01.jpg'),
          title: '作品123213',
          content: new Date()
        },
        {
          img: require('@/assets/material01.jpg'),
          title: '作品123213',
          content: new Date()
        },
        {
          img: require('@/assets/material01.jpg'),
          title: '作品123213',
          content: new Date()
        },
        {
          img: require('@/assets/material01.jpg'),
          title: '作品123213',
          content: new Date()
        },
        {
          img: require('@/assets/material01.jpg'),
          title: '作品123213',
          content: new Date()
        }
      ]
    }
  },
  mounted() {

  },
  methods: {
    jumpToDetail() {
      // 跳转到详情页面
      this.$router.push('/work-detail')
    }
  }
}
</script>

<style scoped>
.works-box {
  padding: 30px;
}
.box-header {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  line-height: 40px;
  padding: 0 20px;
  margin-bottom: 30px;
}
.box-header-title {
  font-size: 26px;
  font-weight: bold;
}
.box-header-author {
  display: inline-block;
  width: 80%;
  border-bottom: 1px solid #ccc;
  font-size: 12px;
  color: #666;
}
.card-container {
  position: relative;
  margin-bottom: 30px;
  cursor: pointer;
  height: 350px;
  width: 100%;
  overflow: hidden;
}
.card-introduce {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  color: #000;
}
.en-text {
  user-select: none;
  font-size: 12px;
  font-size: 7.2px;
  -webkit-transform: scale(0.60);
  width: 500px;
  text-align: center;
  margin-top: 5px;
}
.card-item {
  height: 100%;
}
.card-image {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%
}
.card-image img {
  width: 100%;
}
</style>

